<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>系统管理</title>
<%@ include file="/common/util.jsp"%>



<script type="text/javascript">
$(document).ready(function(){
	//jumpPage(1);
	for ( var i = 1; i < 11; i++) {
        $("#id" + i).removeClass("current");
    }
    $("#id8").addClass("current");

});
function jumpPage(pageIndex){   
	$("#lightRelationMain").attr("action", "${cdnctx}/systemLightRelation/jumpPage.shtml");
	$("#pageIndex").val(pageIndex);
	$("#lightRelationMain").submit(); 
}
var obj = {
	addlightRelation : function(){
		$("#lightRelationMain").attr("action", "${cdnctx}/systemLightRelation/insertInit.shtml");
		$("#lightRelationMain").submit(); 
	},
	updateLightRelation : function(id,modifystamp){
		var sumbitForm =  $("<form  method='post'></form>");
		sumbitForm.attr("action","${cdnctx}/systemLightRelation/updateInit.shtml");
        sumbitForm.append("<input type='hidden' name='pageIndex' value='${pageIndex}'>");
        sumbitForm.append("<input type='hidden' name='modifyStamp' value='"+modifystamp+"'>");
        sumbitForm.append("<input type='hidden' name='id' value='"+id+"'>");
	    sumbitForm.appendTo(document.body).submit();
	},
	searchResert : function(){
		$("#traditioncode").val("");
		$("#ledcode").val("");
	},
	deleteLightRelation : function(id,modifystamp){
		var param = {"id":""+id,"modifystamp":modifystamp};
		$.dialog({
						icon: 'question',
						title:'确认',
						lock:true,
						width:'300px',
						content:'确定要删除吗?',
						ok: function () {
							var sumbitForm =  $("<form  method='post'></form>");
							sumbitForm.attr("action","${cdnctx}/systemLightRelation/delete.shtml");
					        sumbitForm.append("<input type='hidden' name='pageIndex' value='${pageIndex}'>");
        					sumbitForm.append("<input type='hidden' name='modifystamp' value='"+modifystamp+"'>");
        					sumbitForm.append("<input type='hidden' name='id' value='"+id+"'>");
						    sumbitForm.appendTo(document.body).submit(); 	
										    },
					    cancel: function () {
					    }
			
				});
	},
	search : function(){
	
		var testStr = /^[1-9]|[1-9][0-9]d*$/;
		var searchePriceCode = $("#traditioncode").val();
		if(searchePriceCode !="" && !testStr.test(searchePriceCode)){
			$("#traditioncodemsg").attr("title","只能输入正整数！");
			$("#traditioncodemsg").css("display","block");
			return;
		}else{
			$("#traditioncodemsg").css("display","none");
		}
		
		$("#lightRelationMain").submit();
	}
}
</script>
</head>
<body class="main">
	<div class="-frame -style -luster" id="css_container">
		<!--首页框架页眉部分↓-->
		<%@ include file="/WEB-INF/pages/inc/header.jsp"%>
		<!--首页框架页眉部分↑-->

		<div class="content">
			<!-- Left导航菜单◎开始 -->
			<%@ include file="/WEB-INF/pages/inc/leftmenu.jsp"%>

			<div class="main-mid">
				<div class="pos"><img src="${cdnctx}/src/index/img/index.png"><a href="<%--${cdnctx}/system/systemMenu.shtml--%>">系统管理  ></a><a href="${cdnctx}/systemLightRelation/lightRelationMainInit.shtml">灯具对应表管理</a></div>
				<div class="css_contentDiv">
						<form id="lightRelationMain"
							action="${cdnctx}/systemLightRelation/lightRelationMainInit.shtml"
							method="post">
							<input type="hidden" id="pageePriceCode" name="leEnity.lightname"
								value="${leEnity.traditioncode}" />
							<input type="hidden" id="pageePriceType" name="leEnity.lighttype"
								value="${leEnity.ledcode}" />
							<input type="hidden" id="pageIndex" name="pageIndex"
								value="${pageIndex}" />
							<div class="searchArea b-border-radius" style="padding:10px;">
							
								<div id="showNodata">
									<font color="red">&nbsp;&nbsp;&nbsp;&nbsp;<%
										out.print((request.getParameter("msg") == null) ? "" : request
												.getParameter("msg"));
									%> ${msg}</font>
								</div>

								<span>传统灯具番号：</span> <input id="traditioncode"
									name="traditioncode" type="text"
									class="inputText b-border-radius a-box-shadow" size="15"
									value='${leEnity.traditioncode == 0 ? "" : leEnity.traditioncode}' />
									<div id="traditioncodemsg" style="display:none;color:red;"></div>

								<span>&nbsp;&nbsp;&nbsp;LED灯具番号：</span> <input id="ledcode"
									name="ledcode" type="text"
									class="inputText b-border-radius a-box-shadow" size="15"
									value='${leEnity.ledcode== 0 ? "" : leEnity.ledcode}' />
									&nbsp;&nbsp;&nbsp;&nbsp;
								<input type="button" class="b-inputButton" value="查&nbsp;询" onclick="obj.search()" />
								<input type="button" class="b-inputButton" value="重置" onclick="obj.searchResert()" />
								<input type="button" class="b-inputButton" value="新&nbsp;增" onclick="obj.addlightRelation()" />
							</div>

						</form>
						<div class="divTable a-border-radius b-box-shadow">
							<div style="height:420px;background-color:white">
								<table width="40%" border="0" cellspacing="0" cellpadding="0"
									class="formTable">
									<thead>
										<tr>
											<td align="center">操作</td>
											<td align="center">传统灯具番号</td>
											<td align="center">LED灯具番号</td>
											<td align="center">修改者</td>
											<td align="center">修改日期</td>
											
										</tr>
									</thead>
									<c:if test="${empty(list) }">
										<tr class="even" align="center" style="color:red">
											<td colspan="8" class="no-data" style="height: 300px;"></td>
										</tr>
									</c:if>
									<c:if test="${not empty(list) }">
										<c:forEach items="${list}" var="entity" varStatus="status">
											<tr <c:if test="${status.index%2==0 }">class="even"</c:if>
												<c:if test="${status.index%2!=0 }">class="odd"</c:if>>
											<td align="center"  width="120px;"><input id='newbutton' type='button'
												class='b-inputButton'
												onclick="obj.updateLightRelation('${entity.id}','${entity.modifystamp}')"
												value='修改' /> <input id='newbutton' type='button'
												class='b-inputButton'
												onclick="obj.deleteLightRelation('${entity.id}','${entity.modifystamp}')"
												value='删除' />
											</td>
											<td align="center" nowrap="nowrap">${entity.traditioncode}</td>
											<td align="center" nowrap="nowrap">${entity.ledcode}</td>
											<td align="center">${entity.modifyby}</td>
											<td align="center">${entity.modifydate.toString().substring(0,entity.modifydate.toString().length()-2)}</td>
											</tr>
										</c:forEach>
									</c:if>
								</table>
							</div>
							<c:if test="${not empty(list) }">
								<div id="pageInfo" class="pageJump">
									<script type="text/javascript">
				            	pagination.getPaginationHtml('JavaScript:jumpPage({0})',${pageIndex},${pageCount},'pageInfo');
				        	</script>
									<c:if test="${!empty(list) }">
				        		共有${dataCount}条数据
				        	</c:if>
								</div>
							</c:if>

						</div>
				</div>
			</div>

		</div>

		<!--首页框架页尾部分↓-->
		<%@ include file="/WEB-INF/pages/inc/footer.jsp"%>
		<!--首页框架页尾部分↑-->
	</div>
</body>
</html>